package com.sh.sales.happysales.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.sh.polymedicine.happysale.net.entity.CashList;
import com.sh.sales.happysales.R;

import java.util.List;

/**
 * Created by zhouyucheng on 2017/9/15.
 */

public class HiswolletAdapter extends BaseAdapter {
    private List<CashList> hisWallets;
    private Context mContext;

    public HiswolletAdapter(Context mContext, List<CashList> cashs) {
        this.mContext=mContext;
        this.hisWallets=cashs;
    }


    @Override
    public int getCount() {
        return hisWallets.size();
    }

    @Override
    public Object getItem(int i) {
        return hisWallets.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        HisWalletHolder mHisWalletHolder = null;
        if (view == null) {
            mHisWalletHolder = new HisWalletHolder();
            view = LayoutInflater.from(mContext).inflate(R.layout.item_hiswollet, null);
            mHisWalletHolder.getdate = (TextView) view.findViewById(R.id.get_walletdate);
            mHisWalletHolder.getvalue = (TextView) view.findViewById(R.id.get_walletvalue);
            view.setTag(mHisWalletHolder);
        } else {
            mHisWalletHolder = (HisWalletHolder) view.getTag();
        }
        CashList m = hisWallets.get(i);
        mHisWalletHolder.getdate.setText(m.getDate());
        mHisWalletHolder.getvalue.setText(m.getCash() + "");
        return view;
    }

    class HisWalletHolder {
        TextView getvalue;
        TextView getdate;
    }
}
